package com.woyou.service;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.EBean.Scope;

/**
 * 线程池管理工具类
 */
@EBean(scope = Scope.Singleton)
public class ThreadPoolManager {
	private ExecutorService service;

	@AfterInject
	void init(){
		int num = Runtime.getRuntime().availableProcessors();
		// service = Executors.newFixedThreadPool(num * 3);
		service = Executors.newCachedThreadPool();
	}

	public void executeTask(Runnable runnable) {
		service.execute(runnable);
	}
	
	
}
